package com.eagle.gennewdata;
import java.io.IOException;

import javax.servlet.http.*;
import com.eagle.gennewdata.model.NewDaoFactory;
import com.eagle.gennewdata.model.NewRssItem;
import com.eagle.gennewdata.untl.GlobalsFun;

@SuppressWarnings("serial")
public class ShowNewDataServlet extends HttpServlet {
	public static boolean s_bIsRunGen = false;
	
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		
		long nId = 0;
		
		if(req.getParameter("n_id") != null)
			nId = Long.valueOf(req.getParameter("n_id").toString());
		
		NewRssItem item = NewDaoFactory.queryNewRssItemByID(nId);
		resp.setContentType("application/octet-stream;charset=utf-8");
		resp.setHeader("Pragma", "No-cache");
		resp.setHeader("Cache-Control", "no-cache");
		resp.setDateHeader("Expires", 0);
		if (item != null) {
			GlobalsFun.WriteBuffer(resp, item.getContentEncoded());
		}
		NewDaoFactory.close();
	}

}
